﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace CSharpDay07__Singleton_.Models
{
    public class DB
    {
        //Props go Here
        public List<Movie> Movies { get; set; }

        //private Constructor
        private DB() { }

        //Instances
        private static DB instance;
        public static DB Instance
        {
            get
            { 
                return instance ?? (instance = new DB()
                {
                    Movies = new List<Movie>()
                    {
                        new Movie() { Id = 1, ImageUrl = "http://www.poptechjam.com/wp-content/uploads/2012/09/jar-jar-binks-wallpapers_30855_1680x1050.jpg", Rating = MovieRating.PG13, Title = "Jar Jar Gets Punched"},
                        new Movie() { Id = 2, ImageUrl = "https://static.squarespace.com/static/51b3dc8ee4b051b96ceb10de/51ce6099e4b0d911b4489b79/51ce61c7e4b0d911b44a09cf/1272247955049/1000w/jarjar_punched-Stormtrooper.jpg", Rating = MovieRating.R, Title = "Clone Wars Abridged"},
                        new Movie() { Id = 3, ImageUrl = "http://nicolascage.us/wp-content/uploads/2013/10/Jar-Jar-Cage.jpg", Rating = MovieRating.G, Title = "Nicholas Binks"},
                        new Movie() { Id = 4, ImageUrl = "https://hiphopolitic.files.wordpress.com/2009/06/jar_jar_binks_large1.jpeg", Rating = MovieRating.R, Title = "Da Man"},
                        new Movie() { Id = 5, ImageUrl = "https://buffetoblog.files.wordpress.com/2009/10/costume-chef-vader-serving-jar-jar-binks.jpg", Rating = MovieRating.PG, Title = "Dinner is Served"},
                    }
                });
            }
            set
            {
                instance = value;
            }
        }

    }
}